/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package cn.ac.iie.di.wb.picmover.util;

import static cn.ac.iie.di.wb.picmover.util.GlobalParameters.ftpStrs;
import static cn.ac.iie.di.wb.picmover.util.GlobalParameters.ftplist;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.io.FileUtils;
import org.apache.commons.net.ftp.FTPClient;

/**
 *
 * @author Administrator
 */
public class NewClass {

    public static void main(String[] args) {

//        FtpTools ftpTools = new FtpTools();
//        FTPClient createFtpClient = ftpTools.createFtpClient("10.136.16.30", 21, "jr", "111111");
////            FTPClient createFtpClient = ftpTools.createFtpClient("10.136.16.36", 21, "bkftp", "111111");
//
//        boolean downFile = ftpTools.downDataFile(createFtpClient, "10.136.16.30", "/", "C:/Users/Administrator/Desktop/", "/wxdata/wx_mass_pic/20170112/009/85ab9a099fb3f35ef028c1678b8cc07e.jpg", 1800000);
//        System.out.println(downFile);
//        boolean downFile2 = ftpTools.uploadFile(createFtpClient, "10.136.16.30", "/", "/wxdata/wx_mass_pic/20170112/009/85ab9a099fb3f35ef028c1678b8cc07e.jpg", 1800000);
//        System.out.println(downFile2);

//        if (downFile.equals("ERROR")) {
//            ftpTools.destroyFtpClient(createFtpClient);
//            createFtpClient = ftpTools.createFtpClient("10.136.16.23", 21, "swbjr", "111111");
//        }
//        boolean downFile1 = ftpTools.downDataFile1(createFtpClient, "10.136.16.23", "/", "C:/Users/Administrator/Desktop/", "/test/test2");
//        System.out.println(downFile1);
//        File picfile = new File("C:/Users/Administrator/Desktop/test/test1");
//        File newpicfile = new File("C:/Users/Administrator/Desktop/test/a1");
//        try {
//            FileUtils.copyFile(picfile, newpicfile);
//        } catch (IOException ex) {
//            Logger.getLogger(NewClass.class.getName()).log(Level.SEVERE, null, ex);
//        }
//        String[] str = {"", ""};
//        System.out.println(str.length);
//        for (String picStr : str) {
//            if (!picStr.isEmpty()) {
//                System.out.println("not null");
//            } else {
//                System.out.println(" null");
//            }
//        }
        List<String[]> ftplist = new ArrayList<String[]>();
        String ftpStrs = "10.136.16.23,21,swbjr,111111,/;10.136.16.22,21,swbjr,111111,/";
        String[] ftps = ftpStrs.split(";");
        System.out.println(Arrays.toString(ftps));
        for (String ftpStr : ftps) {
            ftplist.add(ftpStr.split(","));
        }
        System.out.println(ftplist);
        String[] picArr = new String[]{};
        System.out.println(picArr.length);

    }
}
